#ifndef __IMHASH_H__
#define __IMHASH_H__

class IMHash
{
public:
	typedef enum
	{
		HT_INVALID,
		HT_MD5,
		HT_SHA,
		HT_SHA1,
		HT_SHA224,
		HT_SHA256,
		HT_SHA384,
		HT_SHA512,
		HT_DSS,
		HT_DSS1,
		HT_MDC2,
		HT_RIPEMD160
	}	HASH_TYPE;

public:
	static IMHash* s_create(HASH_TYPE type);
	static void s_destroy(IMHash* obj);

	static bool s_hash(char* obuf, size_t* olen, const char* buf, size_t blen, HASH_TYPE type);
	static bool s_getSize(size_t& mdsize, HASH_TYPE type);

protected:
	explicit IMHash();
	virtual ~IMHash();

private:
	IMHash& operator = (const IMHash&) { return *this; }

public:
	bool update(const char* buf, size_t blen);
	bool final(char* buf, size_t* blen = NULL);
	size_t getSize(void) const;

protected:
	void*		m_ctx;
};

#endif//!__IMHASH_H__


